package com.jeepig.evaluation.service.impl;

import java.util.List;
import com.jeepig.common.utils.DateUtils;
import com.jeepig.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jeepig.evaluation.mapper.EvaluateMapper;
import com.jeepig.evaluation.domain.Evaluate;
import com.jeepig.evaluation.service.IEvaluateService;

/**
 * 评价项Service业务层处理
 *
 * @author guoxb
 * @date 2025-11-03
 */
@Service
public class EvaluateServiceImpl implements IEvaluateService
{
    @Autowired
    private EvaluateMapper evaluateMapper;

    /**
     * 查询评价项
     *
     * @param id 评价项主键
     * @return 评价项
     */
    @Override
    public Evaluate selectEvaluateById(String id)
    {
        return evaluateMapper.selectEvaluateById(id);
    }

    /**
     * 查询评价项列表
     *
     * @param evaluate 评价项
     * @return 评价项
     */
    @Override
    public List<Evaluate> selectEvaluateList(Evaluate evaluate)
    {
        return evaluateMapper.selectEvaluateList(evaluate);
    }

    /**
     * 新增评价项
     *
     * @param evaluate 评价项
     * @return 结果
     */
    @Override
    public int insertEvaluate(Evaluate evaluate)
    {
        evaluate.setCreateBy(SecurityUtils.getUsername());
        evaluate.setCreateTime(DateUtils.getNowDate());
        return evaluateMapper.insertEvaluate(evaluate);
    }

    /**
     * 修改评价项
     *
     * @param evaluate 评价项
     * @return 结果
     */
    @Override
    public int updateEvaluate(Evaluate evaluate)
    {
        evaluate.setUpdateBy(SecurityUtils.getUsername());
        evaluate.setUpdateTime(DateUtils.getNowDate());
        return evaluateMapper.updateEvaluate(evaluate);
    }

    /**
     * 批量删除评价项
     *
     * @param ids 需要删除的评价项主键
     * @return 结果
     */
    @Override
    public int deleteEvaluateByIds(String[] ids)
    {
        return evaluateMapper.deleteEvaluateByIds(ids);
    }

    /**
     * 删除评价项信息
     *
     * @param id 评价项主键
     * @return 结果
     */
    @Override
    public int deleteEvaluateById(String id)
    {
        return evaluateMapper.deleteEvaluateById(id);
    }
}
